import ThemeContext from "../context/theme_context"
// context共享
// context中定义的值，通过props传值的方式，传给调用该函数的组件实例
function withTheme(OriginComponent) {
  return (props) => {
    return (
      <ThemeContext.Consumer>
        {
          value => {
            return <OriginComponent {...value} {...props} />
          }
        }
      </ThemeContext.Consumer>
    )
  }
}

export default withTheme